#include <bits/stdc++.h>
#include <cstring>
using namespace std;
const int maxn = 9+2;
const char dirs[] = "NESW";
const char turns[] = "LFR";
const int dr[] = {-1, 0, 1, 0};
const int dc[] = {0, 1, 0, -1};

struct node{
    int r, c, di;
    explicit node(int r0=0, int c0=0, int di0 = 0):r(r0), c(c0), di(di0){}
};


int id_turn(char c) {return strchr(turns, c) - turns;}
int id_dirs(char c) {return strchr(dirs, c) - dirs;}
unsigned int d[maxn][maxn][4];
bool e[maxn][maxn][4][3];
node p[maxn][maxn][4], start;

inline bool in(node &u){
    return u.r>=1 && u.r<=9 && u.c>=1 && u.c<=9;
}

int r0, c0, sdir, r2, c2;


node walk(node &u, int tu){
    int di = u.di;
    if(tu == 0) di = (di+3)%4;
    if(tu == 2) di = (di+1)%4;
    int tr = u.r + dr[di];
    int tc = u.c + dc[di];
    return node(tr, tc, di);
}

void print(node &u){
    vector<node> ans;
    for (node t=u; ; t = p[t.r][t.c][t.di]) {
        ans.push_back(t);
        if(d[t.r][t.c][t.di] == 2) break;
    }
    ans.push_back(start);

    reverse(ans.begin(), ans.end());
    int k;
    for (k = 1; k <= ans.size(); ++k) {
        if(k==1) printf(" ");
        printf(" (%d,%d)", ans[k-1].r, ans[k-1].c);
        if(k%10 == 0) printf("\n ");
    }
    --k;
    if(k%10 != 0) printf("\n");
}

void bfs(){
    queue<node> q;
    int r1 = r0 + dr[sdir], c1 = c0 + dc[sdir];
    q.push(node(r1, c1, sdir));
    d[r1][c1][sdir] = 2;
    while(!q.empty()){
        node u = q.front(); q.pop();
        if(u.r==r2 && u.c==c2) {print(u); return;}

        for (int i = 0; i < 3; ++i) {
            if(e[u.r][u.c][u.di][i]){
                node u2 = walk(u, i);
                if(in(u2) && !d[u2.r][u2.c][u2.di]){
                    d[u2.r][u2.c][u2.di] = d[u.r][u.c][u.di] + 1;
                    p[u2.r][u2.c][u2.di] = u;
                    q.push(u2);
                }
            }
        }
    }
    printf("  No Solution Possible\n");
}



int main() {
    ios_base::sync_with_stdio(false);cin.tie(nullptr);
    char name[25]; char s2[25];
    while(scanf("%s%d%d%s%d%d", name, &r0, &c0, s2, &r2, &c2) == 6){
        printf("%s\n", name);
        memset(e, false, sizeof(e));
        memset(d, 0, sizeof(d));
        memset(p, 0, sizeof(p));
        sdir = id_dirs(s2[0]);
        start.r = r0; start.c = c0; start.di = sdir;
        e[r0][c0][sdir][1] = true;
        int a, b; char s3[5];
        while(scanf("%d", &a) == 1 && a!=0){
            scanf("%d", &b);
            while(scanf("%s", s3) && s3[0]!='*'){
                int di = id_dirs(s3[0]);
                for (int i = 1; i < strlen(s3); ++i) {
                    int tu = id_turn(s3[i]);
                    e[a][b][di][tu] = true;
                }
            }
        }
        bfs();
    }
    return 0;
}